package http.bio;


import http.bio.thread.SingleSocketRedirectThread;
import utils.Consts;
import utils.ThreadPoolUtil;

import java.net.ServerSocket;
import java.net.Socket;

public class BioSocketServer {
    public static void main(String[] args) throws InterruptedException {

        try{
            System.out.println("Listenning at port " + Consts.getProp("listenPort"));
            ServerSocket serverSocket = new ServerSocket(Integer.parseInt(Consts.getProp("listenPort")));
            while(true){
                Socket socket = serverSocket.accept();
                ThreadPoolUtil.fixedThreadPool.execute(new SingleSocketRedirectThread(socket));
            }
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}